<?php 
	require_once 'text03.php';
 ?>
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>所有用户</title>
</head>
<body>
<a href="text.html">添加用户</a>
<table style='text-align:left;' border='1'><tr><th>id</th><th>名字</th><th>年龄</th><th>修改</th></tr>
	<?php 
		/*$con=connectDB();*/
		$con=@mysql_connect('localhost','root','root');
		mysql_select_db('myapp');
		//$result=mysql_query("SELECT * FROM users");
		$result=mysql_query("SELECT * FROM users ORDER BY id DESC");//排序
		$dataCount=mysql_num_rows($result);
		/*echo "<table style='text-align:left;' border='1'><tr><th>id</th><th>名字</th><th>年龄</th></tr>";*/
		for ($i=0; $i < $dataCount; $i++) { 
			$result_arr=mysql_fetch_assoc($result);
			/*print_r($result_arr);*/
			$id=$result_arr['id'];
			$name=$result_arr['name'];
			$age=$result_arr['age'];
			echo "<tr><td>$id</td><td>$name</td><td>$age</td><td><a href='edit.php?id=$id'>修改</a> <a href='delete.php?id=$id'>删除</a></td></tr>";
			/*?>
				<tr><td><?php echo $id ?></td><td><?php echo $name ?></td><td><?php echo $age ?></td></tr>//混合编写

			<?php*/
		}
		/*echo "</table>"*/
	 ?>
	 </table>
</body>
</html>